
# find the stack that do not contain 'not_want' and contain 'must_have'. 
not_want = []
#  /\
#  ||
#  and
#  ||
#  \/
must_have = []

def have_not_want(line):
    for s in not_want:
        if line.find(s) >= 0:
            return True
    return False


def have_must_have(line):
    if len(must_have) == 0:
        return True

    for s in must_have:
        if line.find(s) >= 0:
            return True
    return False


if __name__ == '__main__':
    file_in = sys.argv[1]
    data = ''
    threads = []

    with open(file_in, 'r') as f:
        lines = f.readlines[]

    # split into threads
    for line in lines:
        if line.startswith('Thread '):
            threads.append('')
        threads[-1] += line
    
    # filter
    for thread in threads:
        if not have_not_want(thread) and have_must_have(thread):
            print(thread)

